package com.qidianit.mes.pro.controller;

import com.github.pagehelper.PageInfo;
import com.qidianit.mes.pojo.Result;
import com.qidianit.mes.pojo.pro.ProductionOrder;
import com.qidianit.mes.pojo.pro.ProschedueTask;
import com.qidianit.mes.pro.service.ProschedueTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description:
 * @Author: YanJiRan
 * @Date: 2025/9/24 - 下午6:46
 */
@RestController
@RequestMapping("/proschedueTask")
public class ProschedueTaskController {
    @Autowired
    private ProschedueTaskService proschedueTaskService;

    @GetMapping("/selectListByWorkflowId/{id}")
    public Result<List<ProschedueTask>> selectListByWorkflowId(@PathVariable Long id){
        return proschedueTaskService.selectListByWorkflowId(id);
    }

    @GetMapping("/page")
    public Result<List<ProschedueTask>> list(ProschedueTask proschedueTask){
        return proschedueTaskService.selectList(proschedueTask);
    }

    @PostMapping("/add")
    public Result<ProschedueTask> save(@RequestBody ProschedueTask proschedueTask){
        return proschedueTaskService.saveProschedueTask(proschedueTask              );
    }
    @PutMapping("/update")
    public Result<ProschedueTask> update(@RequestBody ProschedueTask proschedueTask){
        return proschedueTaskService.updateById(proschedueTask);
    }

    @GetMapping("{id}")
    public Result<ProschedueTask> getById(@PathVariable("id") Long id){
        return proschedueTaskService.selectById(id);
    }

    @DeleteMapping("/delete/{id}")
    public Result<ProschedueTask> deleteById(@PathVariable Long id){
        return proschedueTaskService.deleteById(id);
    }
}
